<template>
<div>
   <!-- 轮播 -->
    <Banner></Banner>
    <div class="n-main-content">
    <!-- 内容 -->
    <div class="main-body">
        <side-menu active="2"></side-menu>
        <div class="a-main">
           <div class="wy-main-title">
                <p>首页 / 新闻资讯 / <span>国内新闻</span></p>
             </div>
            <div class="a-main-contentList">
                  <a-list itemLayout="vertical" size="large" :pagination="pagination"  :dataSource="listData">
                    <a-list-item slot="renderItem" slot-scope="item, index" key="item.title">

                      <a-list-item-meta>
                          <a slot="title"  :href="`/news/internal/${item.contentId}`">
                            {{item.contentTitle}}
                         </a>
                      </a-list-item-meta>
                      <div>{{item.createTime?item.createTime.split(' ')[0]:''}}</div>

                   </a-list-item>
                  </a-list>
            </div>
        </div>
    </div>
  </div>
</div>
</template>

<script>
import SideMenu from './../components/SideMenu.vue'
import Banner from './../components/Banner.vue'
// import {newsData} from './../../../utils/newsData'

export default {
   components: {
        SideMenu,
        Banner
    },
  data () {
    return {
      listData:[],
      pagination: {
              defaultCurrent: 1,
              defaultPageSize: 6,
              total:10,
              onChange: (page) => {
                this.pagination.defaultCurrent = page
                this.tofindNews()
              },
            },
    }
  },
  created(){
    this.tofindNews()
  },
  methods:{
        //新闻查询
      async tofindNews () {
          const res = await this.$store.dispatch('news/tofindNews',{
          pageSize: this.pagination.defaultPageSize,
          pageNum: this.pagination.defaultCurrent,
          contentType:51//国内新闻
          })
          if (res.status) {
            this.listData = res.data.rows;
            this.pagination.total = res.data.total;

          } 
      },
  }
}
</script>
<style lang="scss">
</style>